﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using AccessControl.Contracts.Models;
using Action = AccessControl.Contracts.Models.Action;

namespace AccessControl.Data.Models
{
    /// <summary>
    /// Represents operator in the system
    /// </summary>
    /// <remarks></remarks>
    public class Operator : Model, IOperator
    {
        #region Fields

        string _UserName, _Password;
        ObservableCollection<Action> _AllowedActions = new ObservableCollection<Action>();

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the name of the user.
        /// </summary>
        /// <value>
        /// The name of the user.
        /// </value>
        public string UserName
        {
            get { return _UserName; }
            set
            {
                if (_UserName != value)
                {
                    _UserName = value;
                    NotifyPropertyChanged("UserName");
                }
            }
        }

        /// <summary>
        /// Gets or sets the password.
        /// </summary>
        /// <value>
        /// The password.
        /// </value>
        public string Password
        {
            get { return _Password; }
            set
            {
                if (_Password != value)
                {
                    _Password = value;
                    NotifyPropertyChanged("Password");
                }
            }
        }

        /// <summary>
        /// Gets the allowed actions.
        /// </summary>
        public IList<Action> AllowedActions
        {
            get { return _AllowedActions; }
        }
        
        #endregion
    }
}
